home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / m4-1_0_3.lha / m4-1.0.3 / configure < prev    next >
Text File  |  1992-12-19  |  13KB  |  525 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec_prefix, and --no-create.
  23.  
  24. trap 'rm -f conftest* core; exit 1' 1 3 15
  25.  
  26. for arg
  27. do
  28.   # Handle --exec_prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  39.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  40.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  41.     next_exec_prefix=yes ;;
  42.  
  43.      -gas | --gas | --ga | --g) ;;
  44.  
  45.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  46.      -host | --host | --hos | --ho | --h)
  47.     next_host=yes ;;
  48.  
  49.      -nfp | --nfp | --nf) ;;
  50.  
  51.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  52.         no_create=1 ;;
  53.  
  54.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  55.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  56.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  57.     next_prefix=yes ;;
  58.  
  59.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  60.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  61.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  62.     next_srcdir=yes ;;
  63.  
  64.      -with-* | --with-*) ;;
  65.  
  66.      *) ;;
  67.     esac
  68.   fi
  69. done
  70.  
  71. rm -f conftest*
  72. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  73.  
  74. # A filename unique to this package, relative to the directory that
  75. # configure is in, which we can look for to find out if srcdir is correct.
  76. unique_file=m4.c
  77.  
  78. # Find the source files, if location was not specified.
  79. if test -z "$srcdir"; then
  80.   srcdirdefaulted=yes
  81.   # Try the directory containing this script, then `..'.
  82.   prog=$0
  83.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  84.   test "X$confdir" = "X$prog" && confdir=.
  85.   srcdir=$confdir
  86.   if test ! -r $srcdir/$unique_file; then
  87.     srcdir=..
  88.   fi
  89. fi
  90. if test ! -r $srcdir/$unique_file; then
  91.   if test x$srcdirdefaulted = xyes; then
  92.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  93.   else
  94.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  95.   fi
  96.   exit 1
  97. fi
  98. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  99. # But we can't avoid them for `..', to make subdirectories work.
  100. case $srcdir in
  101.   .|/*|~*) ;;
  102.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  103. esac
  104.  
  105. if test -z "$CC"; then
  106.   echo checking for gcc
  107.   saveifs="$IFS"; IFS="${IFS}:"
  108.   for dir in $PATH; do
  109.     test -z "$dir" && dir=.
  110.     if test -f $dir/gcc; then
  111.       CC="gcc"
  112.       break
  113.     fi
  114.   done
  115.   IFS="$saveifs"
  116. fi
  117. test -z "$CC" && CC="cc"
  118.  
  119. # Find out if we are using GNU C, under whatever name.
  120. cat <<EOF > conftest.c
  121. #ifdef __GNUC__
  122.   yes
  123. #endif
  124. EOF
  125. ${CC-cc} -E conftest.c > conftest.out 2>&1
  126. if egrep yes conftest.out >/dev/null 2>&1; then
  127.   GCC=1 # For later tests.
  128.   CC="$CC -O"
  129. fi
  130. rm -f conftest*
  131.  
  132. if test -z "$RANLIB"; then
  133.   echo checking for ranlib
  134.   saveifs="$IFS"; IFS="${IFS}:"
  135.   for dir in $PATH; do
  136.     test -z "$dir" && dir=.
  137.     if test -f $dir/ranlib; then
  138.       RANLIB="ranlib"
  139.       break
  140.     fi
  141.   done
  142.   IFS="$saveifs"
  143. fi
  144. test -z "$RANLIB" && RANLIB="@:"
  145.  
  146. # Make sure to not get the incompatible SysV /etc/install and
  147. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  148. # or the SunOS /usr/etc/install directory, or the AIX /bin/install.
  149. if test -z "$INSTALL"; then
  150.   echo checking for install
  151.   saveifs="$IFS"; IFS="${IFS}:"
  152.   for dir in $PATH; do
  153.     test -z "$dir" && dir=.
  154.     case $dir in
  155.     /etc|/usr/sbin|/usr/etc) ;;
  156.     *)
  157.       if test -f $dir/install; then
  158.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  159.       : AIX
  160.     else
  161.       INSTALL="$dir/install -c"
  162.       INSTALL_PROGRAM='$(INSTALL)'
  163.       INSTALL_DATA='$(INSTALL) -m 644'
  164.       break
  165.     fi
  166.       fi
  167.       ;;
  168.     esac
  169.   done
  170.   IFS="$saveifs"
  171. fi
  172. INSTALL=${INSTALL-cp}
  173. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  174. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  175.  
  176. for p in mawk gawk nawk awk
  177. do
  178. if test -z "$AWK"; then
  179.   echo checking for $p
  180.   saveifs="$IFS"; IFS="${IFS}:"
  181.   for dir in $PATH; do
  182.     test -z "$dir" && dir=.
  183.     if test -f $dir/$p; then
  184.       AWK="$p"
  185.       break
  186.     fi
  187.   done
  188.   IFS="$saveifs"
  189. fi
  190. test -z "$AWK" && AWK=""
  191.  
  192. test -n "$AWK" && break
  193. done
  194.  
  195. echo checking for POSIXized ISC
  196. if test -d /etc/conf/kconfig.d &&
  197.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  198. then
  199.   ISC=1 # If later tests want to check for ISC.
  200.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  201.   if test -n "$GCC"; then
  202.     CC="$CC -posix"
  203.   else
  204.     CC="$CC -Xp"
  205.   fi
  206. fi
  207.  
  208. echo checking for working const
  209. echo "
  210. main() { exit(0); } t() { /* Ultrix mips cc rejects this.  */
  211. typedef int charset[2]; const charset x;
  212. /* SunOS 4.1.1 cc rejects this. */
  213. char const *const *p;
  214. char **p2;
  215. /* HPUX 7.0 cc rejects these. */
  216. ++p;
  217. p2 = (char const* const*) p;
  218.  }" > conftest.c
  219. if eval $compile; then
  220.   :
  221. else
  222.   DEFS="$DEFS -Dconst="
  223. fi
  224. rm -f conftest*
  225.  
  226. echo checking for ANSI prototypes
  227. echo checking how to run the C preprocessor
  228. if test -z "$CPP"; then
  229.   CPP='${CC-cc} -E'
  230.   cat <<EOF > conftest.c
  231.  
  232. #include <stdio.h>
  233. EOF
  234. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  235. if test -z "$err"; then
  236.   :
  237. else
  238.   CPP=/lib/cpp
  239. fi
  240. rm -f conftest*
  241. fi
  242.  
  243. cat <<EOF > conftest.c
  244.  
  245. #ifdef __STDC__
  246.   yes
  247. #endif
  248.  
  249. EOF
  250. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  251. if egrep "yes" conftest.out >/dev/null 2>&1; then
  252.   :
  253. else 
  254.   U=_
  255. fi
  256. rm -f conftest*
  257.  
  258.  
  259. echo checking for ANSI C header files
  260. cat <<EOF > conftest.c
  261.  
  262. #include <stdlib.h>
  263. #include <stdarg.h>
  264. #include <string.h>
  265. #include <float.h>
  266. #include <limits.h>
  267. EOF
  268. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  269. if test -z "$err"; then
  270.   DEFS="$DEFS -DSTDC_HEADERS=1"
  271. fi
  272. rm -f conftest*
  273.  
  274. for hdr in string.h
  275. do
  276. trfrom='[a-z]./' trto='[A-Z]__'
  277. echo checking for $hdr
  278. cat <<EOF > conftest.c
  279.  
  280. #include <$hdr>
  281. EOF
  282. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  283. if test -z "$err"; then
  284.   DEFS="$DEFS -DHAVE_`echo $hdr|tr "$trfrom" "$trto"`=1"
  285. fi
  286. rm -f conftest*
  287. done
  288.  
  289. echo checking whether string.h declares mem functions
  290. echo '#include <string.h>' > conftest.c
  291. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  292. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  293.   :
  294. else 
  295.   echo checking for memory.h
  296. cat <<EOF > conftest.c
  297.  
  298. #include <memory.h>
  299. EOF
  300. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  301. if test -z "$err"; then
  302.   DEFS="$DEFS -DNEED_MEMORY_H=1"
  303. fi
  304. rm -f conftest*
  305.  
  306. fi
  307. rm -f conftest*
  308.  
  309.  
  310. echo checking for size_t in sys/types.h
  311. echo '#include <sys/types.h>' > conftest.c
  312. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  313. if egrep "size_t" conftest.out >/dev/null 2>&1; then
  314.   :
  315. else 
  316.   DEFS="$DEFS -Dsize_t=unsigned"
  317. fi
  318. rm -f conftest*
  319.  
  320. echo checking for tmpfile
  321. echo "
  322. main() { exit(0); } t() { 
  323. /* Override any gcc2 internal prototype to avoid an error.  */
  324. extern char tmpfile(); tmpfile(); }" > conftest.c
  325. if eval $compile; then
  326.   DEFS="$DEFS -DHAVE_TMPFILE=1"
  327. else
  328.   tmpfile_missing=1
  329. fi
  330. rm -f conftest*
  331.  
  332. if test -n "$tmpfile_missing"; then
  333. echo checking for mkstemp
  334. echo "
  335. main() { exit(0); } t() { 
  336. /* Override any gcc2 internal prototype to avoid an error.  */
  337. extern char mkstemp(); mkstemp(); }" > conftest.c
  338. if eval $compile; then
  339.   DEFS="$DEFS -DHAVE_MKSTEMP=1"
  340. fi
  341. rm -f conftest*
  342.  
  343. fi
  344. echo '#include <stdlib.h>' > conftest.c
  345. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  346. if egrep "ecvt" conftest.out >/dev/null 2>&1; then
  347.   DEFS="$DEFS -DHAVE_EFGCVT=2"
  348. else 
  349.   echo checking for ecvt
  350. echo "
  351. main() { exit(0); } t() { 
  352. /* Override any gcc2 internal prototype to avoid an error.  */
  353. extern char ecvt(); ecvt(); }" > conftest.c
  354. if eval $compile; then
  355.   DEFS="$DEFS -DHAVE_EFGCVT=1"
  356. fi
  357. rm -f conftest*
  358.  
  359. fi
  360. rm -f conftest*
  361.  
  362. for func in vfprintf
  363. do
  364. echo checking for ${func}
  365. echo "
  366. main() { exit(0); } t() { 
  367. /* Override any gcc2 internal prototype to avoid an error.  */
  368. extern char ${func}(); ${func}(); }" > conftest.c
  369. if eval $compile; then
  370.   :
  371. else
  372.   LIBOBJS="$LIBOBJS ${func}.o"
  373. fi
  374. rm -f conftest*
  375.  
  376. done
  377.  
  378. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  379. # for constant arguments.  Useless!
  380. echo checking for working alloca.h
  381. echo "#include <alloca.h>
  382. main() { exit(0); } t() { char *p = alloca(2 * sizeof(int)); }" > conftest.c
  383. if eval $compile; then
  384.   DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  385. fi
  386. rm -f conftest*
  387.  
  388. decl="#ifdef __GNUC__
  389. #define alloca __builtin_alloca
  390. #else
  391. #if HAVE_ALLOCA_H
  392. #include <alloca.h>
  393. #else
  394. #ifdef _AIX
  395.  #pragma alloca
  396. #else
  397. char *alloca ();
  398. #endif
  399. #endif
  400. #endif
  401. "
  402. echo checking for alloca
  403. echo "$decl
  404. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  405. if eval $compile; then
  406.   :
  407. else
  408.   alloca_missing=1
  409. fi
  410. rm -f conftest*
  411.  
  412. if test -n "$alloca_missing"; then
  413.   SAVELIBS="$LIBS"
  414.   # Maybe alloca is in a different library.
  415.   #if test -f /usr/ucblib/libucb.a; then
  416.     # Avoid the broken BSD compatibility library as much as possible.
  417.     #LIBS="$LIBS -L/usr/ucblib -lc -lucb" trylib=-lucb # SVR4
  418.   #el
  419.   if test -f /lib/libPW.a; then
  420.     LIBS="$LIBS -lPW" trylib=-lPW # SVR2 and SVR3
  421.   fi
  422.   if test -n "$trylib"; then
  423.     alloca_missing=
  424.     echo checking for alloca in $trylib
  425. echo "$decl
  426. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  427. if eval $compile; then
  428.   :
  429. else
  430.   alloca_missing=1
  431. fi
  432. rm -f conftest*
  433.  
  434.   fi
  435.   if test -n "$alloca_missing"; then
  436.     LIBS="$SAVELIBS" ALLOCA=alloca.o
  437.   fi
  438. fi
  439.  
  440. if test -n "$prefix"; then
  441.   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  442.   prsub="s%^prefix[     ]*=.*$%prefix = $prefix%"
  443. fi
  444. if test -n "$exec_prefix"; then
  445.   prsub="$prsub
  446. s%^exec_prefix[     ]*=.*$%exec_prefix = $exec_prefix%"
  447. fi
  448.  
  449. trap 'rm -f config.status; exit 1' 1 3 15
  450. echo creating config.status
  451. rm -f config.status
  452. cat <<EOF > config.status
  453. #!/bin/sh
  454. # Generated automatically by configure.
  455. # Run this file to recreate the current configuration.
  456. # This directory was configured as follows,
  457. # on host `(hostname || uname -n) 2>/dev/null`:
  458. #
  459. # $0 $*
  460.  
  461. case "\$1" in
  462.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  463.   exec /bin/sh $0 $* ;;
  464. esac
  465.  
  466. trap 'rm -f Makefile lib/Makefile checks/Makefile; exit 1' 1 3 15
  467. CC='$CC'
  468. RANLIB='$RANLIB'
  469. INSTALL='$INSTALL'
  470. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  471. INSTALL_DATA='$INSTALL_DATA'
  472. AWK='$AWK'
  473. CPP='$CPP'
  474. U='$U'
  475. LIBOBJS='$LIBOBJS'
  476. ALLOCA='$ALLOCA'
  477. LIBS='$LIBS'
  478. srcdir='$srcdir'
  479. DEFS='$DEFS'
  480. prefix='$prefix'
  481. exec_prefix='$exec_prefix'
  482. prsub='$prsub'
  483. EOF
  484. cat <<\EOF >> config.status
  485.  
  486. top_srcdir=$srcdir
  487. for file in Makefile lib/Makefile checks/Makefile; do
  488.   srcdir=$top_srcdir
  489.   # Remove last slash and all that follows it.  Not all systems have dirname.
  490.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  491.   if test "$dir" != "$file"; then
  492.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  493.     test ! -d $dir && mkdir $dir
  494.   fi
  495.   echo creating $file
  496.   rm -f $file
  497.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  498.   sed -e "
  499. $prsub
  500. s%@CC@%$CC%g
  501. s%@RANLIB@%$RANLIB%g
  502. s%@INSTALL@%$INSTALL%g
  503. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  504. s%@INSTALL_DATA@%$INSTALL_DATA%g
  505. s%@AWK@%$AWK%g
  506. s%@CPP@%$CPP%g
  507. s%@U@%$U%g
  508. s%@LIBOBJS@%$LIBOBJS%g
  509. s%@ALLOCA@%$ALLOCA%g
  510. s%@LIBS@%$LIBS%g
  511. s%@srcdir@%$srcdir%g
  512. s%@DEFS@%$DEFS%" $top_srcdir/${file}.in >> $file
  513. done
  514.  
  515. EOF
  516. chmod +x config.status
  517. test -n "$no_create" || ./config.status
  518.  
  519.  
  520. if test $srcdir != .; then
  521.   echo "creating check files"
  522.   test ! -d checks && mkdir checks
  523.   cp $srcdir/checks/[0-9][0-9].* $srcdir/checks/incl.m4 $srcdir/checks/foo checks
  524. fi
  525.